{extend name="index/base" /}
{block name="menu"}

<div class="tpl-content-wrapper">
    <div class="tpl-content-page-title">
        节点列表
    </div>
    <ol class="am-breadcrumb">
        <li><a href="{:url('admin/index/index')}" class="am-icon-home">首页</a></li>
        <li class="am-active">权限管理</li>
        <li class="am-active">节点列表</li>
    </ol>
    <div class="tpl-portlet-components">
        <div class="portlet-title">
            <div class="caption font-green bold">
                <span class="am-icon-code"></span> 节点列表
            </div>
            <div class="tpl-portlet-input tpl-fz-ml">
                <div class="portlet-input input-small input-inline">
                    <div class="input-icon right">
                         </div>
                </div>
            </div>


        </div>
        <div class="tpl-block">
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <a type="button" class="am-btn am-btn-default am-btn-success" href="{:url('index/node/create')}"><span class="am-icon-plus"></span> 新增</a>

                        </div>
                    </div>
                </div>
            </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main am-table-centered am-table-compact">
                            <thead>
                            <tr>
                                <th class="table-check"><input type="checkbox" class="tpl-table-fz-check"></th>
                                <th class="table-id">ID</th>
                                <th class="table-title">节点名</th>
                                <th class="table-type">mname</th>
                                <th class="table-type">aname</th>
                                <th class="table-date am-hide-sm-only">状态</th>
                                <th class="table-set">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name='list' id='alist'}
                            <tr>
                                <td><input type="checkbox"></td>
                                <td>{$alist.id}</td>
                                <td>{$alist.name}</td>
                                <td>{$alist.mname}</td>
                                <td>{$alist.aname}</td>
                                <td class="am-hide-sm-only">{if $alist.status==0}禁用{else}激活{/if}</td>
                                <td>
                                    <div class="">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a href="{:url('index/node/edit',['id'=>$alist.id])}" class="am-btn am-btn-default am-btn-xs fff"><span class="am-icon-pencil-square-o"></span> 编辑节点</a>

                                            <button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only bbb-bb" onclick="del(this)" data-t="{$alist.id}">删除</button>

                                        </div>
                                    </div>
                                </td>
                            </tr>
                            {/volist}

                            </tbody>
                        </table>
                        <div class="am-cf">
                            <div class="am-fr" >
                                <style>
                                    .pagination li{
                                        float:left;
                                        margin-right:20px;
                                    }
                                </style>
                                {$list->render()}
                            </div>
                        </div>

                        <hr>
                    </form>
                </div>
            </div>
        </div>
        <div class="tpl-alert"></div>
    </div>

    <script>

        function del(aaa) {
//        console.log(aaa);
            var data = $(aaa).attr('data-t');
//        console.log(data);
            var _this = $(aaa);
            $.ajax({
                type:'delete',
                url:'node/'+data,
                synsc:'true',
                success:function(aa){
                    if(aa){
                        _this.parents('tr').remove();
                        alert('删除成功');
                    }
                },
                error:function(){
                    alert('删除失败');
                }
            });

        };
    </script>



</div>
{/block}



